function ransoncalc(age, wbc, glucose, ast, ldh,  hct, bun, calcium, po2, base, fluids){

var ransonscore=0;
var severity ="likely";
mortality="2% mortality";

if (age){age=1;}else{age=0;}
if (wbc){wbc=1;}else{wbc=0;}
if (glucose){glucose=1;}else{glucose=0;}
if (ast){ast=1;}else{ast=0;}
if (ldh){ldh=1;}else{ldh=0;}
if (hct){hct=1;}else{hct=0;}
if (bun){bun=1;}else{bun=0;}
if (calcium){calcium=1;}else{calcium=0;}
if (po2){po2=1;}else{po2=0;}
if (base){base=1;}else{base=0;}
if (fluids){fluids=1;}else{fluids=0;}

ransonscore= age + wbc + glucose + ast + ldh + hct + bun + calcium + po2 + base + fluids;


if (ransonscore < 3) {
severity ="unlikely"; //pancreatitis
}


if (ransonscore == 3 || ransonscore == 4) {mortality = "15% mortality.";}
if (ransonscore == 5 || ransonscore == 6) {mortality = "40% mortality.";}
if (ransonscore > 6) {mortality = "100% mortality.";}


return {
			 severity:severity,
			 ransonscore:ransonscore,
			 mortality:mortality

	};		 
}



function ref(){
// display reference
var wikipedia="<br /><a href='http://en.wikipedia.org/wiki/Ranson_criteria'>Wikipedia on Ranson's Criteria</a>";

 return "Ranson JH et al. Prognostic signs and the role of operative management in acute pancreatitis. Surgery, Gynecology & Obstetrics 1974 139 (1): 69-8" + wikipedia;
}


